<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - mbi.info - test/impl/framework.ipp</title>
  <link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../../index.html">directory</a> - <a href="index.html">test/impl</a> - framework.ipp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>mbi.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2010-01-23</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">176</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">72.7 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">128</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : //  (C) Copyright Gennadiy Rozental 2005-2008.
<span class="lineNum">       2 </span>                : //  Distributed under the Boost Software License, Version 1.0.
<span class="lineNum">       3 </span>                : //  (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       4 </span>                : //  http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       5 </span>                : 
<span class="lineNum">       6 </span>                : //  See http://www.boost.org/libs/test for the library home page.
<span class="lineNum">       7 </span>                : //
<span class="lineNum">       8 </span>                : //  File        : $RCSfile$
<span class="lineNum">       9 </span>                : //
<span class="lineNum">      10 </span>                : //  Version     : $Revision: 49312 $
<span class="lineNum">      11 </span>                : //
<span class="lineNum">      12 </span>                : //  Description : implements framework API - main driver for the test
<span class="lineNum">      13 </span>                : // ***************************************************************************
<span class="lineNum">      14 </span>                : 
<span class="lineNum">      15 </span>                : #ifndef BOOST_TEST_FRAMEWORK_IPP_021005GER
<span class="lineNum">      16 </span>                : #define BOOST_TEST_FRAMEWORK_IPP_021005GER
<span class="lineNum">      17 </span>                : 
<span class="lineNum">      18 </span>                : // Boost.Test
<span class="lineNum">      19 </span>                : #include &lt;boost/test/framework.hpp&gt;
<span class="lineNum">      20 </span>                : #include &lt;boost/test/execution_monitor.hpp&gt;
<span class="lineNum">      21 </span>                : #include &lt;boost/test/debug.hpp&gt;
<span class="lineNum">      22 </span>                : #include &lt;boost/test/unit_test_suite_impl.hpp&gt;
<span class="lineNum">      23 </span>                : #include &lt;boost/test/unit_test_log.hpp&gt;
<span class="lineNum">      24 </span>                : #include &lt;boost/test/unit_test_monitor.hpp&gt;
<span class="lineNum">      25 </span>                : #include &lt;boost/test/test_observer.hpp&gt;
<span class="lineNum">      26 </span>                : #include &lt;boost/test/results_collector.hpp&gt;
<span class="lineNum">      27 </span>                : #include &lt;boost/test/progress_monitor.hpp&gt;
<span class="lineNum">      28 </span>                : #include &lt;boost/test/results_reporter.hpp&gt;
<span class="lineNum">      29 </span>                : #include &lt;boost/test/test_tools.hpp&gt;
<span class="lineNum">      30 </span>                : 
<span class="lineNum">      31 </span>                : #include &lt;boost/test/detail/unit_test_parameters.hpp&gt;
<span class="lineNum">      32 </span>                : #include &lt;boost/test/detail/global_typedef.hpp&gt;
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : #include &lt;boost/test/utils/foreach.hpp&gt;
<span class="lineNum">      35 </span>                : 
<span class="lineNum">      36 </span>                : // Boost
<span class="lineNum">      37 </span>                : #include &lt;boost/timer.hpp&gt;
<span class="lineNum">      38 </span>                : 
<span class="lineNum">      39 </span>                : // STL
<span class="lineNum">      40 </span>                : #include &lt;map&gt;
<span class="lineNum">      41 </span>                : #include &lt;set&gt;
<span class="lineNum">      42 </span>                : #include &lt;cstdlib&gt;
<span class="lineNum">      43 </span>                : #include &lt;ctime&gt;
<span class="lineNum">      44 </span>                : 
<span class="lineNum">      45 </span>                : #ifdef BOOST_NO_STDC_NAMESPACE
<span class="lineNum">      46 </span>                : namespace std { using ::time; using ::srand; }
<span class="lineNum">      47 </span>                : #endif
<span class="lineNum">      48 </span>                : 
<span class="lineNum">      49 </span>                : #include &lt;boost/test/detail/suppress_warnings.hpp&gt;
<span class="lineNum">      50 </span>                : 
<span class="lineNum">      51 </span>                : //____________________________________________________________________________//
<span class="lineNum">      52 </span>                : 
<span class="lineNum">      53 </span>                : namespace boost {
<span class="lineNum">      54 </span>                : 
<span class="lineNum">      55 </span>                : namespace unit_test {
<span class="lineNum">      56 </span>                : 
<span class="lineNum">      57 </span>                : // ************************************************************************** //
<span class="lineNum">      58 </span>                : // **************            test_start calls wrapper          ************** //
<span class="lineNum">      59 </span>                : // ************************************************************************** //
<span class="lineNum">      60 </span>                : 
<span class="lineNum">      61 </span>                : namespace ut_detail {
<span class="lineNum">      62 </span>                : 
<span class="lineNum">      63 </span>                : struct test_start_caller {
<span class="lineNum">      64 </span><span class="lineCov">              4 :     test_start_caller( test_observer* to, counter_t tc_amount )</span>
<span class="lineNum">      65 </span>                :     : m_to( to )
<span class="lineNum">      66 </span><span class="lineCov">              4 :     , m_tc_amount( tc_amount )</span>
<span class="lineNum">      67 </span><span class="lineCov">              4 :     {}</span>
<span class="lineNum">      68 </span>                : 
<span class="lineNum">      69 </span><span class="lineCov">              4 :     int operator()()</span>
<span class="lineNum">      70 </span>                :     {
<span class="lineNum">      71 </span><span class="lineCov">              4 :         m_to-&gt;test_start( m_tc_amount );</span>
<span class="lineNum">      72 </span><span class="lineCov">              4 :         return 0;</span>
<span class="lineNum">      73 </span>                :     }
<span class="lineNum">      74 </span>                : 
<span class="lineNum">      75 </span>                : private:
<span class="lineNum">      76 </span>                :     // Data members
<span class="lineNum">      77 </span>                :     test_observer*  m_to;
<span class="lineNum">      78 </span>                :     counter_t       m_tc_amount;
<span class="lineNum">      79 </span>                : };
<span class="lineNum">      80 </span>                : 
<span class="lineNum">      81 </span>                : //____________________________________________________________________________//
<span class="lineNum">      82 </span>                : 
<span class="lineNum">      83 </span>                : struct test_init_caller {
<span class="lineNum">      84 </span><span class="lineCov">              2 :     explicit    test_init_caller( init_unit_test_func init_func ) </span>
<span class="lineNum">      85 </span><span class="lineCov">              2 :     : m_init_func( init_func )</span>
<span class="lineNum">      86 </span><span class="lineCov">              2 :     {}</span>
<span class="lineNum">      87 </span><span class="lineCov">              2 :     int         operator()()</span>
<span class="lineNum">      88 </span>                :     {
<span class="lineNum">      89 </span>                : #ifdef BOOST_TEST_ALTERNATIVE_INIT_API
<span class="lineNum">      90 </span><span class="lineCov">              2 :         if( !(*m_init_func)() )</span>
<span class="lineNum">      91 </span><span class="lineNoCov">              0 :             throw std::runtime_error( &quot;test module initialization failed&quot; );</span>
<span class="lineNum">      92 </span>                : #else
<span class="lineNum">      93 </span>                :         test_suite*  manual_test_units = (*m_init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv );
<span class="lineNum">      94 </span>                : 
<span class="lineNum">      95 </span>                :         if( manual_test_units )
<span class="lineNum">      96 </span>                :             framework::master_test_suite().add( manual_test_units );
<span class="lineNum">      97 </span>                : #endif
<span class="lineNum">      98 </span><span class="lineCov">              2 :         return 0;</span>
<span class="lineNum">      99 </span>                :     }
<span class="lineNum">     100 </span>                : 
<span class="lineNum">     101 </span>                :     // Data members
<span class="lineNum">     102 </span>                :     init_unit_test_func m_init_func;
<span class="lineNum">     103 </span>                : };
<span class="lineNum">     104 </span>                : 
<span class="lineNum">     105 </span>                : }
<span class="lineNum">     106 </span>                : 
<span class="lineNum">     107 </span>                : // ************************************************************************** //
<span class="lineNum">     108 </span>                : // **************                   framework                  ************** //
<span class="lineNum">     109 </span>                : // ************************************************************************** //
<span class="lineNum">     110 </span>                : 
<span class="lineNum">     111 </span>                : class framework_impl : public test_tree_visitor {
<span class="lineNum">     112 </span>                : public:
<span class="lineNum">     113 </span><span class="lineCov">              2 :     framework_impl()</span>
<span class="lineNum">     114 </span>                :     : m_master_test_suite( 0 )
<span class="lineNum">     115 </span>                :     , m_curr_test_case( INV_TEST_UNIT_ID )
<span class="lineNum">     116 </span>                :     , m_next_test_case_id( MIN_TEST_CASE_ID )
<span class="lineNum">     117 </span>                :     , m_next_test_suite_id( MIN_TEST_SUITE_ID )
<span class="lineNum">     118 </span>                :     , m_is_initialized( false )
<span class="lineNum">     119 </span><span class="lineCov">              2 :     , m_test_in_progress( false )</span>
<span class="lineNum">     120 </span><span class="lineCov">              2 :     {}</span>
<span class="lineNum">     121 </span>                : 
<span class="lineNum">     122 </span><span class="lineCov">              2 :     ~framework_impl() { clear(); }</span>
<span class="lineNum">     123 </span>                : 
<span class="lineNum">     124 </span><span class="lineCov">              2 :     void            clear()</span>
<span class="lineNum">     125 </span>                :     {
<span class="lineNum">     126 </span><span class="lineCov">             15 :         while( !m_test_units.empty() ) {</span>
<span class="lineNum">     127 </span><span class="lineCov">             11 :             test_unit_store::value_type const&amp; tu = *m_test_units.begin();</span>
<span class="lineNum">     128 </span>                : 
<span class="lineNum">     129 </span>                :             // the delete will erase this element from map
<span class="lineNum">     130 </span><span class="lineCov">             11 :             if( test_id_2_unit_type( tu.second-&gt;p_id ) == tut_suite )</span>
<span class="lineNum">     131 </span><span class="lineCov">              4 :                 delete  (test_suite const*)tu.second;</span>
<span class="lineNum">     132 </span>                :             else
<span class="lineNum">     133 </span><span class="lineCov">              7 :                 delete  (test_case const*)tu.second;</span>
<span class="lineNum">     134 </span>                :         }
<span class="lineNum">     135 </span><span class="lineCov">              2 :     }</span>
<span class="lineNum">     136 </span>                : 
<span class="lineNum">     137 </span><span class="lineCov">             11 :     void            set_tu_id( test_unit&amp; tu, test_unit_id id ) { tu.p_id.value = id; }</span>
<span class="lineNum">     138 </span>                : 
<span class="lineNum">     139 </span>                :     // test_tree_visitor interface implementation
<span class="lineNum">     140 </span><span class="lineCov">              7 :     void            visit( test_case const&amp; tc )</span>
<span class="lineNum">     141 </span>                :     {
<span class="lineNum">     142 </span><span class="lineCov">              7 :         if( !tc.check_dependencies() ) {</span>
<span class="lineNum">     143 </span><span class="lineNoCov">              0 :             BOOST_TEST_FOREACH( test_observer*, to, m_observers )</span>
<span class="lineNum">     144 </span><span class="lineNoCov">              0 :                 to-&gt;test_unit_skipped( tc );</span>
<span class="lineNum">     145 </span>                : 
<span class="lineNum">     146 </span><span class="lineNoCov">              0 :             return;</span>
<span class="lineNum">     147 </span>                :         }
<span class="lineNum">     148 </span>                : 
<span class="lineNum">     149 </span><span class="lineCov">             21 :         BOOST_TEST_FOREACH( test_observer*, to, m_observers )</span>
<span class="lineNum">     150 </span><span class="lineCov">             14 :             to-&gt;test_unit_start( tc );</span>
<span class="lineNum">     151 </span>                : 
<span class="lineNum">     152 </span><span class="lineCov">              7 :         boost::timer tc_timer;</span>
<span class="lineNum">     153 </span><span class="lineCov">              7 :         test_unit_id bkup = m_curr_test_case;</span>
<span class="lineNum">     154 </span><span class="lineCov">              7 :         m_curr_test_case = tc.p_id;</span>
<span class="lineNum">     155 </span><span class="lineCov">              7 :         unit_test_monitor_t::error_level run_result = unit_test_monitor.execute_and_translate( tc );</span>
<span class="lineNum">     156 </span>                : 
<span class="lineNum">     157 </span><span class="lineCov">              7 :         unsigned long elapsed = static_cast&lt;unsigned long&gt;( tc_timer.elapsed() * 1e6 );</span>
<span class="lineNum">     158 </span>                : 
<span class="lineNum">     159 </span><span class="lineCov">              7 :         if( unit_test_monitor.is_critical_error( run_result ) ) {</span>
<span class="lineNum">     160 </span><span class="lineNoCov">              0 :             BOOST_TEST_FOREACH( test_observer*, to, m_observers )</span>
<span class="lineNum">     161 </span><span class="lineNoCov">              0 :                 to-&gt;test_aborted();</span>
<span class="lineNum">     162 </span>                :         }
<span class="lineNum">     163 </span>                : 
<span class="lineNum">     164 </span><span class="lineCov">             21 :         BOOST_TEST_FOREACH( test_observer*, to, m_observers )</span>
<span class="lineNum">     165 </span><span class="lineCov">             14 :             to-&gt;test_unit_finish( tc, elapsed );</span>
<span class="lineNum">     166 </span>                : 
<span class="lineNum">     167 </span><span class="lineCov">              7 :         m_curr_test_case = bkup;</span>
<span class="lineNum">     168 </span>                : 
<span class="lineNum">     169 </span><span class="lineCov">              7 :         if( unit_test_monitor.is_critical_error( run_result ) )</span>
<span class="lineNum">     170 </span><span class="lineNoCov">              0 :             throw test_being_aborted();</span>
<span class="lineNum">     171 </span>                :     }
<span class="lineNum">     172 </span>                : 
<span class="lineNum">     173 </span><span class="lineCov">              4 :     bool            test_suite_start( test_suite const&amp; ts )</span>
<span class="lineNum">     174 </span>                :     {
<span class="lineNum">     175 </span><span class="lineCov">              4 :         if( !ts.check_dependencies() ) {</span>
<span class="lineNum">     176 </span><span class="lineNoCov">              0 :             BOOST_TEST_FOREACH( test_observer*, to, m_observers )</span>
<span class="lineNum">     177 </span><span class="lineNoCov">              0 :                 to-&gt;test_unit_skipped( ts );</span>
<span class="lineNum">     178 </span>                : 
<span class="lineNum">     179 </span><span class="lineNoCov">              0 :             return false;</span>
<span class="lineNum">     180 </span>                :         }
<span class="lineNum">     181 </span>                : 
<span class="lineNum">     182 </span><span class="lineCov">             12 :         BOOST_TEST_FOREACH( test_observer*, to, m_observers )</span>
<span class="lineNum">     183 </span><span class="lineCov">              8 :             to-&gt;test_unit_start( ts );</span>
<span class="lineNum">     184 </span>                : 
<span class="lineNum">     185 </span><span class="lineCov">              4 :         return true;</span>
<span class="lineNum">     186 </span>                :     }
<span class="lineNum">     187 </span>                : 
<span class="lineNum">     188 </span><span class="lineCov">              4 :     void            test_suite_finish( test_suite const&amp; ts )</span>
<span class="lineNum">     189 </span>                :     {
<span class="lineNum">     190 </span><span class="lineCov">             12 :         BOOST_TEST_FOREACH( test_observer*, to, m_observers )</span>
<span class="lineNum">     191 </span><span class="lineCov">              8 :             to-&gt;test_unit_finish( ts, 0 );</span>
<span class="lineNum">     192 </span><span class="lineCov">              4 :     }</span>
<span class="lineNum">     193 </span>                : 
<span class="lineNum">     194 </span>                :     //////////////////////////////////////////////////////////////////
<span class="lineNum">     195 </span>                :     struct priority_order {
<span class="lineNum">     196 </span><span class="lineCov">              6 :         bool operator()( test_observer* lhs, test_observer* rhs ) const</span>
<span class="lineNum">     197 </span>                :         {
<span class="lineNum">     198 </span><span class="lineCov">              6 :             return (lhs-&gt;priority() &lt; rhs-&gt;priority()) || ((lhs-&gt;priority() == rhs-&gt;priority()) &amp;&amp; (lhs &lt; rhs));</span>
<span class="lineNum">     199 </span>                :         }
<span class="lineNum">     200 </span>                :     };
<span class="lineNum">     201 </span>                : 
<span class="lineNum">     202 </span>                :     typedef std::map&lt;test_unit_id,test_unit*&gt;       test_unit_store;
<span class="lineNum">     203 </span>                :     typedef std::set&lt;test_observer*,priority_order&gt; observer_store;
<span class="lineNum">     204 </span>                : 
<span class="lineNum">     205 </span>                :     master_test_suite_t* m_master_test_suite;
<span class="lineNum">     206 </span>                :     test_unit_id    m_curr_test_case;
<span class="lineNum">     207 </span>                :     test_unit_store m_test_units;
<span class="lineNum">     208 </span>                : 
<span class="lineNum">     209 </span>                :     test_unit_id    m_next_test_case_id;
<span class="lineNum">     210 </span>                :     test_unit_id    m_next_test_suite_id;
<span class="lineNum">     211 </span>                : 
<span class="lineNum">     212 </span>                :     bool            m_is_initialized;
<span class="lineNum">     213 </span>                :     bool            m_test_in_progress;
<span class="lineNum">     214 </span>                : 
<span class="lineNum">     215 </span>                :     observer_store  m_observers;
<span class="lineNum">     216 </span>                : };
<span class="lineNum">     217 </span>                : 
<span class="lineNum">     218 </span>                : //____________________________________________________________________________//
<span class="lineNum">     219 </span>                : 
<span class="lineNum">     220 </span>                : namespace {
<span class="lineNum">     221 </span>                : 
<span class="lineNum">     222 </span><span class="lineCov">            475 : framework_impl&amp; s_frk_impl() { static framework_impl the_inst; return the_inst; }</span>
<span class="lineNum">     223 </span>                : 
<span class="lineNum">     224 </span>                : } // local namespace
<span class="lineNum">     225 </span>                : 
<span class="lineNum">     226 </span>                : //____________________________________________________________________________//
<span class="lineNum">     227 </span>                : 
<span class="lineNum">     228 </span>                : namespace framework {
<span class="lineNum">     229 </span>                : 
<span class="lineNum">     230 </span>                : void
<span class="lineNum">     231 </span><span class="lineCov">              2 : init( init_unit_test_func init_func, int argc, char* argv[] )</span>
<span class="lineNum">     232 </span>                : {
<span class="lineNum">     233 </span><span class="lineCov">              2 :     runtime_config::init( &amp;argc, argv );</span>
<span class="lineNum">     234 </span>                : 
<span class="lineNum">     235 </span>                :     // set the log level and format
<span class="lineNum">     236 </span><span class="lineCov">              2 :     unit_test_log.set_threshold_level( runtime_config::log_level() );</span>
<span class="lineNum">     237 </span><span class="lineCov">              2 :     unit_test_log.set_format( runtime_config::log_format() );</span>
<span class="lineNum">     238 </span>                : 
<span class="lineNum">     239 </span>                :     // set the report level and format
<span class="lineNum">     240 </span><span class="lineCov">              2 :     results_reporter::set_level( runtime_config::report_level() );</span>
<span class="lineNum">     241 </span><span class="lineCov">              2 :     results_reporter::set_format( runtime_config::report_format() );</span>
<span class="lineNum">     242 </span>                : 
<span class="lineNum">     243 </span><span class="lineCov">              2 :     register_observer( results_collector );</span>
<span class="lineNum">     244 </span><span class="lineCov">              2 :     register_observer( unit_test_log );</span>
<span class="lineNum">     245 </span>                : 
<span class="lineNum">     246 </span><span class="lineCov">              2 :     if( runtime_config::show_progress() )</span>
<span class="lineNum">     247 </span><span class="lineNoCov">              0 :         register_observer( progress_monitor );</span>
<span class="lineNum">     248 </span>                : 
<span class="lineNum">     249 </span><span class="lineCov">              2 :     if( runtime_config::detect_memory_leaks() &gt; 0 ) {</span>
<span class="lineNum">     250 </span><span class="lineCov">              2 :         debug::detect_memory_leaks( true );</span>
<span class="lineNum">     251 </span><span class="lineCov">              2 :         debug::break_memory_alloc( runtime_config::detect_memory_leaks() );</span>
<span class="lineNum">     252 </span>                :     }
<span class="lineNum">     253 </span>                : 
<span class="lineNum">     254 </span>                :     // init master unit test suite
<span class="lineNum">     255 </span><span class="lineCov">              2 :     master_test_suite().argc = argc;</span>
<span class="lineNum">     256 </span><span class="lineCov">              2 :     master_test_suite().argv = argv;</span>
<span class="lineNum">     257 </span>                : 
<span class="lineNum">     258 </span>                :     try {
<span class="lineNum">     259 </span><span class="lineCov">              2 :         boost::execution_monitor em;</span>
<span class="lineNum">     260 </span>                : 
<span class="lineNum">     261 </span><span class="lineCov">              2 :         ut_detail::test_init_caller tic( init_func );</span>
<span class="lineNum">     262 </span>                : 
<span class="lineNum">     263 </span><span class="lineCov">              2 :         em.execute( tic );</span>
<span class="lineNum">     264 </span>                :     }
<span class="lineNum">     265 </span><span class="lineNoCov">              0 :     catch( execution_exception const&amp; ex )  {</span>
<span class="lineNum">     266 </span><span class="lineNoCov">              0 :         throw setup_error( ex.what() );</span>
<span class="lineNum">     267 </span>                :     }
<span class="lineNum">     268 </span>                : 
<span class="lineNum">     269 </span><span class="lineCov">              2 :     s_frk_impl().m_is_initialized = true;</span>
<span class="lineNum">     270 </span><span class="lineCov">              2 : }</span>
<span class="lineNum">     271 </span>                : 
<span class="lineNum">     272 </span>                : //____________________________________________________________________________//
<span class="lineNum">     273 </span>                : 
<span class="lineNum">     274 </span>                : bool
<span class="lineNum">     275 </span><span class="lineCov">             13 : is_initialized()</span>
<span class="lineNum">     276 </span>                : {
<span class="lineNum">     277 </span><span class="lineCov">             13 :     return  s_frk_impl().m_is_initialized;</span>
<span class="lineNum">     278 </span>                : }
<span class="lineNum">     279 </span>                : 
<span class="lineNum">     280 </span>                : //____________________________________________________________________________//
<span class="lineNum">     281 </span>                : 
<span class="lineNum">     282 </span>                : void
<span class="lineNum">     283 </span><span class="lineCov">              7 : register_test_unit( test_case* tc )</span>
<span class="lineNum">     284 </span>                : {
<span class="lineNum">     285 </span><span class="lineCov">              7 :     if( tc-&gt;p_id != INV_TEST_UNIT_ID )</span>
<span class="lineNum">     286 </span><span class="lineNoCov">              0 :         throw setup_error( BOOST_TEST_L( &quot;test case already registered&quot; ) );</span>
<span class="lineNum">     287 </span>                : 
<span class="lineNum">     288 </span><span class="lineCov">              7 :     test_unit_id new_id = s_frk_impl().m_next_test_case_id;</span>
<span class="lineNum">     289 </span>                : 
<span class="lineNum">     290 </span><span class="lineCov">              7 :     if( new_id == MAX_TEST_CASE_ID )</span>
<span class="lineNum">     291 </span><span class="lineNoCov">              0 :         throw setup_error( BOOST_TEST_L( &quot;too many test cases&quot; ) );</span>
<span class="lineNum">     292 </span>                : 
<span class="lineNum">     293 </span>                :     typedef framework_impl::test_unit_store::value_type map_value_type;
<span class="lineNum">     294 </span>                : 
<span class="lineNum">     295 </span><span class="lineCov">              7 :     s_frk_impl().m_test_units.insert( map_value_type( new_id, tc ) );</span>
<span class="lineNum">     296 </span><span class="lineCov">              7 :     s_frk_impl().m_next_test_case_id++;</span>
<span class="lineNum">     297 </span>                : 
<span class="lineNum">     298 </span><span class="lineCov">              7 :     s_frk_impl().set_tu_id( *tc, new_id );</span>
<span class="lineNum">     299 </span><span class="lineCov">              7 : }</span>
<span class="lineNum">     300 </span>                : 
<span class="lineNum">     301 </span>                : //____________________________________________________________________________//
<span class="lineNum">     302 </span>                : 
<span class="lineNum">     303 </span>                : void
<span class="lineNum">     304 </span><span class="lineCov">              4 : register_test_unit( test_suite* ts )</span>
<span class="lineNum">     305 </span>                : {
<span class="lineNum">     306 </span><span class="lineCov">              4 :     if( ts-&gt;p_id != INV_TEST_UNIT_ID )</span>
<span class="lineNum">     307 </span><span class="lineNoCov">              0 :         throw setup_error( BOOST_TEST_L( &quot;test suite already registered&quot; ) );</span>
<span class="lineNum">     308 </span>                : 
<span class="lineNum">     309 </span><span class="lineCov">              4 :     test_unit_id new_id = s_frk_impl().m_next_test_suite_id;</span>
<span class="lineNum">     310 </span>                : 
<span class="lineNum">     311 </span><span class="lineCov">              4 :     if( new_id == MAX_TEST_SUITE_ID )</span>
<span class="lineNum">     312 </span><span class="lineNoCov">              0 :         throw setup_error( BOOST_TEST_L( &quot;too many test suites&quot; ) );</span>
<span class="lineNum">     313 </span>                : 
<span class="lineNum">     314 </span>                :     typedef framework_impl::test_unit_store::value_type map_value_type;
<span class="lineNum">     315 </span><span class="lineCov">              4 :     s_frk_impl().m_test_units.insert( map_value_type( new_id, ts ) );</span>
<span class="lineNum">     316 </span><span class="lineCov">              4 :     s_frk_impl().m_next_test_suite_id++;</span>
<span class="lineNum">     317 </span>                : 
<span class="lineNum">     318 </span><span class="lineCov">              4 :     s_frk_impl().set_tu_id( *ts, new_id );</span>
<span class="lineNum">     319 </span><span class="lineCov">              4 : }</span>
<span class="lineNum">     320 </span>                : 
<span class="lineNum">     321 </span>                : //____________________________________________________________________________//
<span class="lineNum">     322 </span>                : 
<span class="lineNum">     323 </span>                : void
<span class="lineNum">     324 </span><span class="lineCov">             11 : deregister_test_unit( test_unit* tu )</span>
<span class="lineNum">     325 </span>                : {
<span class="lineNum">     326 </span><span class="lineCov">             11 :     s_frk_impl().m_test_units.erase( tu-&gt;p_id );</span>
<span class="lineNum">     327 </span><span class="lineCov">             11 : }</span>
<span class="lineNum">     328 </span>                : 
<span class="lineNum">     329 </span>                : //____________________________________________________________________________//
<span class="lineNum">     330 </span>                : 
<span class="lineNum">     331 </span>                : void
<span class="lineNum">     332 </span><span class="lineNoCov">              0 : clear()</span>
<span class="lineNum">     333 </span>                : {
<span class="lineNum">     334 </span><span class="lineNoCov">              0 :     s_frk_impl().clear();</span>
<span class="lineNum">     335 </span><span class="lineNoCov">              0 : }</span>
<span class="lineNum">     336 </span>                : 
<span class="lineNum">     337 </span>                : //____________________________________________________________________________//
<span class="lineNum">     338 </span>                : 
<span class="lineNum">     339 </span>                : void
<span class="lineNum">     340 </span><span class="lineCov">              4 : register_observer( test_observer&amp; to )</span>
<span class="lineNum">     341 </span>                : {
<span class="lineNum">     342 </span><span class="lineCov">              4 :     s_frk_impl().m_observers.insert( &amp;to );</span>
<span class="lineNum">     343 </span><span class="lineCov">              4 : }</span>
<span class="lineNum">     344 </span>                : 
<span class="lineNum">     345 </span>                : //____________________________________________________________________________//
<span class="lineNum">     346 </span>                : 
<span class="lineNum">     347 </span>                : void
<span class="lineNum">     348 </span><span class="lineNoCov">              0 : deregister_observer( test_observer&amp; to )</span>
<span class="lineNum">     349 </span>                : {
<span class="lineNum">     350 </span><span class="lineNoCov">              0 :     s_frk_impl().m_observers.erase( &amp;to );</span>
<span class="lineNum">     351 </span><span class="lineNoCov">              0 : }</span>
<span class="lineNum">     352 </span>                : 
<span class="lineNum">     353 </span>                : //____________________________________________________________________________//
<span class="lineNum">     354 </span>                : 
<span class="lineNum">     355 </span>                : void
<span class="lineNum">     356 </span><span class="lineNoCov">              0 : reset_observers()</span>
<span class="lineNum">     357 </span>                : {
<span class="lineNum">     358 </span><span class="lineNoCov">              0 :     s_frk_impl().m_observers.clear();</span>
<span class="lineNum">     359 </span><span class="lineNoCov">              0 : }</span>
<span class="lineNum">     360 </span>                : 
<span class="lineNum">     361 </span>                : //____________________________________________________________________________//
<span class="lineNum">     362 </span>                : 
<span class="lineNum">     363 </span>                : master_test_suite_t&amp;
<span class="lineNum">     364 </span><span class="lineCov">             12 : master_test_suite()</span>
<span class="lineNum">     365 </span>                : {
<span class="lineNum">     366 </span><span class="lineCov">             12 :     if( !s_frk_impl().m_master_test_suite )</span>
<span class="lineNum">     367 </span><span class="lineCov">              2 :         s_frk_impl().m_master_test_suite = new master_test_suite_t;</span>
<span class="lineNum">     368 </span>                : 
<span class="lineNum">     369 </span><span class="lineCov">             12 :     return *s_frk_impl().m_master_test_suite;</span>
<span class="lineNum">     370 </span>                : }
<span class="lineNum">     371 </span>                : 
<span class="lineNum">     372 </span>                : //____________________________________________________________________________//
<span class="lineNum">     373 </span>                : 
<span class="lineNum">     374 </span>                : test_case const&amp;
<span class="lineNum">     375 </span><span class="lineCov">             13 : current_test_case()</span>
<span class="lineNum">     376 </span>                : {
<span class="lineNum">     377 </span><span class="lineCov">             13 :     return get&lt;test_case&gt;( s_frk_impl().m_curr_test_case );</span>
<span class="lineNum">     378 </span>                : }
<span class="lineNum">     379 </span>                : 
<span class="lineNum">     380 </span>                : //____________________________________________________________________________//
<span class="lineNum">     381 </span>                : 
<span class="lineNum">     382 </span>                : test_unit&amp;
<span class="lineNum">     383 </span><span class="lineCov">             46 : get( test_unit_id id, test_unit_type t )</span>
<span class="lineNum">     384 </span>                : {
<span class="lineNum">     385 </span><span class="lineCov">             46 :     test_unit* res = s_frk_impl().m_test_units[id];</span>
<span class="lineNum">     386 </span>                : 
<span class="lineNum">     387 </span><span class="lineCov">             46 :     if( (res-&gt;p_type &amp; t) == 0 )</span>
<span class="lineNum">     388 </span><span class="lineNoCov">              0 :         throw internal_error( &quot;Invalid test unit type&quot; );</span>
<span class="lineNum">     389 </span>                : 
<span class="lineNum">     390 </span><span class="lineCov">             46 :     return *res;</span>
<span class="lineNum">     391 </span>                : }
<span class="lineNum">     392 </span>                : 
<span class="lineNum">     393 </span>                : //____________________________________________________________________________//
<span class="lineNum">     394 </span>                : 
<span class="lineNum">     395 </span>                : void
<span class="lineNum">     396 </span><span class="lineCov">              2 : run( test_unit_id id, bool continue_test )</span>
<span class="lineNum">     397 </span>                : {
<span class="lineNum">     398 </span><span class="lineCov">              2 :     if( id == INV_TEST_UNIT_ID )</span>
<span class="lineNum">     399 </span><span class="lineCov">              2 :         id = master_test_suite().p_id;</span>
<span class="lineNum">     400 </span>                : 
<span class="lineNum">     401 </span><span class="lineCov">              2 :     test_case_counter tcc;</span>
<span class="lineNum">     402 </span><span class="lineCov">              2 :     traverse_test_tree( id, tcc );</span>
<span class="lineNum">     403 </span>                : 
<span class="lineNum">     404 </span><span class="lineCov">              2 :     if( tcc.p_count == 0 )</span>
<span class="lineNum">     405 </span>                :         throw setup_error( runtime_config::test_to_run().is_empty() 
<span class="lineNum">     406 </span>                :                                 ? BOOST_TEST_L( &quot;test tree is empty&quot; ) 
<span class="lineNum">     407 </span><span class="lineNoCov">              0 :                                 : BOOST_TEST_L( &quot;no test cases matching filter&quot; ) );</span>
<span class="lineNum">     408 </span>                : 
<span class="lineNum">     409 </span><span class="lineCov">              2 :     bool    call_start_finish   = !continue_test || !s_frk_impl().m_test_in_progress;</span>
<span class="lineNum">     410 </span><span class="lineCov">              2 :     bool    was_in_progress     = s_frk_impl().m_test_in_progress;</span>
<span class="lineNum">     411 </span>                : 
<span class="lineNum">     412 </span><span class="lineCov">              2 :     s_frk_impl().m_test_in_progress = true;</span>
<span class="lineNum">     413 </span>                : 
<span class="lineNum">     414 </span><span class="lineCov">              2 :     if( call_start_finish ) {</span>
<span class="lineNum">     415 </span><span class="lineCov">              6 :         BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers ) {</span>
<span class="lineNum">     416 </span><span class="lineCov">              4 :             boost::execution_monitor em;</span>
<span class="lineNum">     417 </span>                : 
<span class="lineNum">     418 </span>                :             try {
<span class="lineNum">     419 </span><span class="lineCov">              4 :                 em.execute( ut_detail::test_start_caller( to, tcc.p_count ) );</span>
<span class="lineNum">     420 </span>                :             }
<span class="lineNum">     421 </span><span class="lineNoCov">              0 :             catch( execution_exception const&amp; ex )  {</span>
<span class="lineNum">     422 </span><span class="lineNoCov">              0 :                 throw setup_error( ex.what() );</span>
<span class="lineNum">     423 </span>                :             }
<span class="lineNum">     424 </span>                :         }
<span class="lineNum">     425 </span>                :     }
<span class="lineNum">     426 </span>                : 
<span class="lineNum">     427 </span><span class="lineCov">              2 :     switch( runtime_config::random_seed() ) {</span>
<span class="lineNum">     428 </span>                :     case 0:
<span class="lineNum">     429 </span><span class="lineCov">              2 :         break;</span>
<span class="lineNum">     430 </span>                :     case 1: {
<span class="lineNum">     431 </span><span class="lineNoCov">              0 :         unsigned int seed = (unsigned int)std::time( 0 );</span>
<span class="lineNum">     432 </span><span class="lineNoCov">              0 :         BOOST_TEST_MESSAGE( &quot;Test cases order is shuffled using seed: &quot; &lt;&lt; seed );</span>
<span class="lineNum">     433 </span><span class="lineNoCov">              0 :         std::srand( seed );</span>
<span class="lineNum">     434 </span><span class="lineNoCov">              0 :         break;</span>
<span class="lineNum">     435 </span>                :     }
<span class="lineNum">     436 </span>                :     default:
<span class="lineNum">     437 </span><span class="lineNoCov">              0 :         BOOST_TEST_MESSAGE( &quot;Test cases order is shuffled using seed: &quot; &lt;&lt; runtime_config::random_seed() );</span>
<span class="lineNum">     438 </span><span class="lineNoCov">              0 :         std::srand( runtime_config::random_seed() );</span>
<span class="lineNum">     439 </span>                :     }
<span class="lineNum">     440 </span>                : 
<span class="lineNum">     441 </span>                :     try {
<span class="lineNum">     442 </span><span class="lineCov">              2 :         traverse_test_tree( id, s_frk_impl() );</span>
<span class="lineNum">     443 </span>                :     }
<span class="lineNum">     444 </span><span class="lineNoCov">              0 :     catch( test_being_aborted const&amp; ) {</span>
<span class="lineNum">     445 </span>                :         // abort already reported
<span class="lineNum">     446 </span>                :     }
<span class="lineNum">     447 </span>                : 
<span class="lineNum">     448 </span><span class="lineCov">              2 :     if( call_start_finish ) {</span>
<span class="lineNum">     449 </span><span class="lineCov">              6 :         BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )</span>
<span class="lineNum">     450 </span><span class="lineCov">              4 :             to-&gt;test_finish();</span>
<span class="lineNum">     451 </span>                :     }
<span class="lineNum">     452 </span>                : 
<span class="lineNum">     453 </span><span class="lineCov">              2 :     s_frk_impl().m_test_in_progress = was_in_progress;</span>
<span class="lineNum">     454 </span><span class="lineCov">              2 : }</span>
<span class="lineNum">     455 </span>                : 
<span class="lineNum">     456 </span>                : //____________________________________________________________________________//
<span class="lineNum">     457 </span>                : 
<span class="lineNum">     458 </span>                : void
<span class="lineNum">     459 </span><span class="lineNoCov">              0 : run( test_unit const* tu, bool continue_test )</span>
<span class="lineNum">     460 </span>                : {
<span class="lineNum">     461 </span><span class="lineNoCov">              0 :     run( tu-&gt;p_id, continue_test );</span>
<span class="lineNum">     462 </span><span class="lineNoCov">              0 : }</span>
<span class="lineNum">     463 </span>                : 
<span class="lineNum">     464 </span>                : //____________________________________________________________________________//
<span class="lineNum">     465 </span>                : 
<span class="lineNum">     466 </span>                : void
<span class="lineNum">     467 </span><span class="lineCov">             13 : assertion_result( bool passed )</span>
<span class="lineNum">     468 </span>                : {
<span class="lineNum">     469 </span><span class="lineCov">             39 :     BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )</span>
<span class="lineNum">     470 </span><span class="lineCov">             26 :         to-&gt;assertion_result( passed );</span>
<span class="lineNum">     471 </span><span class="lineCov">             13 : }</span>
<span class="lineNum">     472 </span>                : 
<span class="lineNum">     473 </span>                : //____________________________________________________________________________//
<span class="lineNum">     474 </span>                : 
<span class="lineNum">     475 </span>                : void
<span class="lineNum">     476 </span><span class="lineNoCov">              0 : exception_caught( execution_exception const&amp; ex )</span>
<span class="lineNum">     477 </span>                : {
<span class="lineNum">     478 </span><span class="lineNoCov">              0 :     BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )</span>
<span class="lineNum">     479 </span><span class="lineNoCov">              0 :         to-&gt;exception_caught( ex );</span>
<span class="lineNum">     480 </span><span class="lineNoCov">              0 : }</span>
<span class="lineNum">     481 </span>                : 
<span class="lineNum">     482 </span>                : //____________________________________________________________________________//
<span class="lineNum">     483 </span>                : 
<span class="lineNum">     484 </span>                : void
<span class="lineNum">     485 </span><span class="lineNoCov">              0 : test_unit_aborted( test_unit const&amp; tu )</span>
<span class="lineNum">     486 </span>                : {
<span class="lineNum">     487 </span><span class="lineNoCov">              0 :     BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )</span>
<span class="lineNum">     488 </span><span class="lineNoCov">              0 :         to-&gt;test_unit_aborted( tu );</span>
<span class="lineNum">     489 </span><span class="lineNoCov">              0 : }</span>
<span class="lineNum">     490 </span>                : 
<span class="lineNum">     491 </span>                : //____________________________________________________________________________//
<span class="lineNum">     492 </span>                : 
<span class="lineNum">     493 </span>                : } // namespace framework
<span class="lineNum">     494 </span>                : 
<span class="lineNum">     495 </span>                : } // namespace unit_test
<span class="lineNum">     496 </span>                : 
<span class="lineNum">     497 </span>                : } // namespace boost
<span class="lineNum">     498 </span>                : 
<span class="lineNum">     499 </span>                : //____________________________________________________________________________//
<span class="lineNum">     500 </span>                : 
<span class="lineNum">     501 </span>                : #include &lt;boost/test/detail/enable_warnings.hpp&gt;
<span class="lineNum">     502 </span>                : 
<span class="lineNum">     503 </span>                : #endif // BOOST_TEST_FRAMEWORK_IPP_021005GER
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
